package com.enqualcomm.kids.manager;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.enqualcomm.kids.R;
import com.enqualcomm.kids.config.userdefault.UserTerminalDefault;
import com.enqualcomm.kids.mvp.reai.ShadowTransformer;
import com.enqualcomm.kids.mvp.reai.TerminalListView;
import com.enqualcomm.kids.view.ReaiBookView;
import com.facebook.drawee.view.SimpleDraweeView;

import common.utils.DensityUtil;

/**
 * Created by Sunzhigang on 2016/7/1.
 */
public class PetModeHanlderImp implements ModeHandler{
    @Override
    public void initMode(Context context, View rootRL
            , boolean q_a_enable, boolean find_enable, boolean voice_notice_enable, boolean wechat_enable, boolean make_call_enable
            , UserTerminalDefault mCurrentUserTerminalDefault, SimpleDraweeView header_iv,boolean oscard_enable,ShadowTransformer shadowTransformer) {
        /**下排按钮*/
//        View app_setting_btn = rootRL.findViewById(R.id.app_setting_btn);
//        View all_terminals_btn = rootRL.findViewById(R.id.all_terminals_btn);
        View dial_btn_rl= rootRL.findViewById(R.id.dial_btn_rl);
        TextView dial_tv= (TextView) rootRL.findViewById(R.id.dial_tv);
        View chat_btn= rootRL.findViewById(R.id.chat_btn);
        TextView chat_tv= (TextView) rootRL.findViewById(R.id.chat_tv);
        View control_btn= rootRL.findViewById(R.id.control_btn);
        TextView control_tv= (TextView) rootRL.findViewById(R.id.control_tv);
        /**头像*/
//        SimpleDraweeView header_iv= (SimpleDraweeView) rootRL.findViewById(R.id.header_iv);

        View phone_book_btn= rootRL.findViewById(R.id.phone_book_btn);
        TextView phone_book_tv= (TextView) rootRL.findViewById(R.id.phone_book_tv);
        /**计步*/
//        TextView pedometer_tv = (TextView) rootRL.findViewById(R.id.pedometer_tv);
        /**书页*/
//        ReaiBookView zainaer_rl = (ReaiBookView) rootRL.findViewById(R.id.zainaer_rl);
//        ReaiBookView kanshijie_rl = (ReaiBookView) rootRL.findViewById(R.id.kanshijie_rl);
//        ReaiBookView oscard_rl = (ReaiBookView) rootRL.findViewById(R.id.oscard_rl);
//        ReaiBookView aizhishi_rl = (ReaiBookView) rootRL.findViewById(R.id.aizhishi_rl);
        /**书签*/
        ImageView book_marker1 = (ImageView) rootRL.findViewById(R.id.book_marker1);
        ImageView book_marker2= (ImageView) rootRL.findViewById(R.id.book_marker2);
        ImageView book_marker3= (ImageView) rootRL.findViewById(R.id.book_marker3);
        ImageView book_marker4 = (ImageView) rootRL.findViewById(R.id.book_marker4);
        /**星座*/
//        ReaiBookView constellation_iv= (ReaiBookView) rootRL.findViewById(R.id.constellation_iv);
        /**头像下拉*/
//        TerminalListView terminal_list= (TerminalListView) rootRL.findViewById(R.id.terminal_list);

        rootRL.setBackgroundResource(R.drawable.bg_reai_pet);
//        pedometer_tv.setBackgroundResource(R.drawable.bg_reai_pedometer_pet);
//        pedometer_tv.setPadding(0, 0, 0, 0);
//        app_setting_btn.setBackgroundResource(R.drawable.bg_reai_setting_btn_pet);
        ImageView zainaer_rl_bg = (ImageView) rootRL.findViewById(R.id.zainaer_rl_bg);
        zainaer_rl_bg.setBackgroundResource(R.drawable.bg_reai_book1_non_pet);
        ImageView kanshijie_rl_bg = (ImageView) rootRL.findViewById(R.id.kanshijie_rl_bg);
        kanshijie_rl_bg.setBackgroundResource(R.drawable.bg_reai_book3_pet);
//        header_iv.setBackgroundResource(R.drawable.reai_header_bg_pet);
//        all_terminals_btn.setBackgroundResource(R.drawable.bg_reai_all_terminals_btn_pet);

        book_marker1.setImageResource(R.drawable.selector_book_marker1_pet);//书签
        book_marker4.setImageResource(R.drawable.selector_book_marker4_pet);
        book_marker2.setVisibility(View.INVISIBLE);

//        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) book_marker1.getLayoutParams();
//        layoutParams.topMargin = DensityUtil.dip2px(context, 403);
//        layoutParams.leftMargin = DensityUtil.dip2px(context, 25);
//        book_marker1.setLayoutParams(layoutParams);
//        layoutParams = (RelativeLayout.LayoutParams) book_marker4.getLayoutParams();
//        layoutParams.topMargin = DensityUtil.dip2px(context, 403);
//        layoutParams.rightMargin = DensityUtil.dip2px(context, 25);
//        book_marker4.setLayoutParams(layoutParams);

        if (find_enable){
            book_marker4.setVisibility(View.VISIBLE);
        }else {
            book_marker4.setVisibility(View.INVISIBLE);
        }

        if (oscard_enable){
            book_marker3.setVisibility(View.VISIBLE);
        }else {
            book_marker3.setVisibility(View.INVISIBLE);
        }

        /**星座*/
//        constellation_iv.setVisibility(View.GONE);
//        constellation_iv.setBackgroundColor(context.getResources().getColor(R.color.transparent));
//        constellation_iv.setClickable(false);

        chat_btn.setBackgroundResource(R.drawable.bg_reai_chat_btn_pet);
        phone_book_btn.setBackgroundResource(R.drawable.bg_reai_time_btn_pet);
        control_btn.setBackgroundResource(R.drawable.bg_reai_control_btn_pet);
        chat_tv.setText(context.getString(R.string.pet_main_information_btn_text));
        phone_book_tv.setText(context.getString(R.string.pet_main_track_btn_text));
        dial_btn_rl.setVisibility(View.GONE);
//        terminal_list.pet();

    }
}
